package com.yj.easydialog;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;

import com.yj.easydialog.dialog.AlertDialog;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        findViewById(R.id.tv_test).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                AlertDialog alertDialog=new AlertDialog.Builder(MainActivity.this).setContentView(R.layout.pinglun_dailog)
                        .setCanceledOnTouchOutside(false)
                        .setFullScreen()
                        .setShowButtom(R.style.dialog_from_bottom_anim)
                        .show();

                final EditText editText = alertDialog.getView(R.id.et_message);
                alertDialog.setOnClickLisner(R.id.but_send, new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        Toast.makeText(MainActivity.this, ""+editText.getText().toString(), Toast.LENGTH_SHORT).show();
                    }
                });
            }
        });

        findViewById(R.id.tv_test2).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                AlertDialog alertDialog=new AlertDialog.Builder(MainActivity.this).setContentView(R.layout.loading)
                        .setCanceledOnTouchOutside(false)
                        .setWindowAnimation(R.style.dialog_window_anim)
                        .show();

            }
        });
    }
}
